package clock;

import javax.swing.JApplet;
import javax.swing.JFrame;

/**
 * Provides the interface behaviour for the interactive ClickCounter.
 */

public class AlarmClockMain extends JApplet {

  public void init() {
    // create a translation independently from the presentation
  	AlarmClockTranslation translation = new AlarmClockTranslation();
    // create an application independently from the translation
    AlarmClock application = new AlarmClock(0, 5);
    // tell the translation about the application
    translation.setApplication(application);
    
    // Link up the translation and presentation
    AlarmClockPresentation visibleInterface = new AlarmClockPresentation(translation);
    // add the presentation to this applet
    this.setContentPane(visibleInterface);
    translation.addPropertyChangeListener(visibleInterface);
    
    // Link up translation and timer
    Time visibleInterface1 = new Time();
    visibleInterface1.addActionListener(translation);
  } // end init.

  public static void main(String args[]) {
    // create a frame around the applet
    JFrame frame = new JFrame("Alarm clock Demo");
    AlarmClockMain theInterface = new AlarmClockMain();
    // invoke the applet's lifecycle methods manually
    theInterface.init();
    // put the applet into the frame
    frame.setContentPane(theInterface);
    // bring the close button to life
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    // lay out components in the frame
    frame.pack();
    // make the GUI visible
    frame.setVisible(true);
  } // end main.
} // end class ClickCounterTranslation.

